function myNew(fn, ...args) {
  let obj = Object.create(fn.prototype);
  // 通过this的隐式
  let res = fn.apply(obj, args);
  // 如果是对象优先输出出去
  return typeof res == 'object' ? res : obj
}

function demo() {
  console.log("执行1遍");
  return { name: 1 }
}
let a1 = new demo(1, 2, 3)
let a2 = myNew(demo, 1, 2, 3);
console.log(a1, a2);